#查看命名空间
kubectl get ns
#创建命名空间
kubectl create ns k8s-demo
#查看所有资源
kubectl get all -n k8s-demo
# 删除命名空间及其所有资源
kubectl delete namespace <namespace-name>


# 通过名称管理 Service
kubectl get service my-service
kubectl describe service my-service
kubectl delete service my-service


# 列出当前命名空间中的所有ConfigMap
kubectl get configmaps
# 列出特定命名空间中的ConfigMap
kubectl get configmaps -n namespace-name
# 获取特定ConfigMap的详细信息
kubectl get configmap cm-as -o yaml



kubectl top pods -l app=conf
kubectl get endpoints conf

# 查看所有pod及其所在的节点
kubectl get pods -o wide
# 查看特定pod的节点信息
kubectl get pod <pod-name> -o wide
#查看pod的详细描述
kubectl describe pod pod-name

kubectl get pod conf-7f47595476-9cpmg -o yaml



kubectl get nodes -o wide




These commands cover the majority of daily Kubernetes operations.
The -n flag allows you to specify a namespace, and many commands support the -o wide option for additional details.